<?php

namespace App\Model;


class PropEvent extends BaseModel
{
    protected $connection = 'api';
    protected $table = 'prop_event';
    protected $primaryKey = 'prop_event_id';
    
    /**
     * 创建或更新
     * prop_event_id 存在则更新，不存在则新增
     * @param $data
     * @return mixed
     */
    public function createOrUpdateData($data) {
        return curl_request(getKkaudioApiUrl().'/inner/prop/event/upsert',$data,'json','POST');
    }
    
    public function giftLibrary() {
        return $this->belongsTo(GiftLibrary::class,'data_id','gift_id');
    }
    
    public function giftPearlLibrary() {
        return $this->belongsTo(GiftPearlLibrary::class,'data_id','gift_id');
    }
    public function giftMall() {
        return $this->belongsTo(MallGoods::class,'data_id','goods_id');
    }
}
